using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
public class Sharp0110
{
    public static void _Main()
    {
        Console.WriteLine("Chapter 1 example 10: encryption 128 bits");
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);
        try
        {
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("Sharp0110.pdf", FileMode.Create));
            writer.SetEncryption(PdfWriter.STRENGTH128BITS, "userpass", "ownerpass", PdfWriter.AllowCopy | PdfWriter.AllowPrinting);
            document.Open();
            document.Add(new Paragraph("This document is Top Secret!"));
            document.Close();
        }
        catch (Exception de)
        {
            Console.Error.WriteLine(de.StackTrace);
        }
    }
}